log(db): Add db failure cause log message#4748
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryMedium Risk Overview CI database migrations now run via Reviewed by Cursor Bugbot for commit 63e3927. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThis PR improves observability for workflow execution failures by surfacing the underlying Postgres/driver error that Drizzle wraps in
Confidence Score: 4/5Safe to merge; changes are purely additive diagnostics with no behavioral impact on the execution path. The core execution path is unchanged —
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[executeWorkflowCore throws] --> B[catch block]
B --> C[logger.error with error + describeErrorCause]
C --> D{describeErrorCause}
D --> E{error instanceof Error?}
E -- No --> F[return undefined]
E -- Yes --> G[Walk cause chain up to depth 10]
G --> H{candidate.code defined?}
H -- Yes --> I[driver = candidate, break]
H -- No --> J[advance to candidate.cause]
J --> G
G -- no Error found --> K[driver = first Error or undefined]
I --> L[filterUndefined on driver fields]
K --> L
L --> M{driver exists?}
M -- No --> F
M -- Yes --> N[Return: name/message/code/severity/detail/routine/errno/syscall]
N --> O[logger merges as cause into structured JSON log entry]
F --> P[cause field omitted from log entry]
|
|
Superseded by #4749, which isolates the logging change cleanly off staging. The two DB/CI commits on this branch (fix(db): disable statement_timeout, fix(ci): route migration workflow) aren't in staging/main yet and will get their own PR. |
Summary
cause(code, severity, detail, routine, errno, syscall) when workflow execution failserror.cause, which the logger's Error serializer dropped — leaving only an opaqueFailed query: ...message with no pg error codecausechain (depth-bounded to 10) and surface the first error carrying acode; this distinguishes a connection drop (08006), rejected connection (53300), and statement timeout (57014)causefield, never a masked failureType of Change
Testing
Tested manually;
bun run lintclean,bun run check:api-validation:strictpassed,tsc --noEmitclean. Motivated by intermittentschedule-executionfailures where the workspace/personal env reads in preprocessing fail with an opaque "Failed query" and no driver error code.Checklist